$(function(){
    //自定义密码校验规则
    layui.form.verify({
        pwd:[/^\S{6,12}$/,'密码长度在6-12位'],
        repwd:function(value){
            var pwd = $('[name="newPwd"]').val();
            if (pwd != value){
                return '密码不一致';
            }
        }
    });
    //密码重置功能
    $('#myform').submit(function(e){
        e.preventDefault();
        $.ajax({
            type:'post',
            url:'/my/updatepwd',
            data:$('#myform').serialize(),
            success:function(res){
                localStorage.removeItem('token');
                window.parent.location.href = '/login.html'
            }
        })
    })




})
